<template>
  <div class="partnerAttorney">
    <div>
      <div class="topBtn">
        <Button type="primary" @click="getPdf()">下载PDF证书</Button>
        &nbsp;&nbsp;
        <Button type="primary" @click="handlePrint()">打印</Button>
      </div>
      <div class="pdefDomContent">
        <div class="pdfDom1">
          <div id="pdfDom" ref="print">
            <div class="pdf_top">Keyroads Partner</div>
            <div class="pdf_company">XXXX信息科技有限公司</div>
            <div class="pdf_company">合作伙伴</div>
            <div class="pdf_enCompany">
              -Software Dealer Partner Keyroads InfoTech(Shanghai) China-
            </div>
            <div class="pdf_content">
              <div>兹证明</div>
              <!-- 企业 -->
              <div class="pdt_Bold" v-if="formItem.Type == 2">
                {{ formItem.Name }}
              </div>
              <div class="pdt_Bold" v-else>
                {{ formItem.Name }}(身份证号：{{ formItem.AdminIdentityCard }})
              </div>
            </div>
            <div class="pdf_content">
              <div>成为</div>
              <div class="pdt_Bold">XXXX信息科技有限公司合作伙伴</div>
            </div>
            <div class="pdf_content">
              <div>合作伙伴成员编号为：</div>
              <div class="pdt_Bold">{{ formItem.PartnerId }}</div>
            </div>
            <div class="pdf_content">
              <div>有效期至:</div>
              <div class="pdt_Bold" v-if="formItem.ExpireTime == 0">
                {{ ExpireTimeString }}
              </div>
              <div class="pdt_Bold" v-else>{{ ExpireTimeString }} 日止</div>
            </div>
            <div class="pdf_content">
              <div>特此证明</div>
            </div>
            <div class="pdf_base">
              备注：
              本证书以正文为有效文本，不得影音、涂改、转让等，上海启路信息科技有限公司拥有对此授权书在法律规范内的最终解释权。
            </div>
            <div class="pdf_chapterImg">
              <!-- <img src="../../../../assets/images/chapter/u8.png" /> -->
            </div>
            <div
              style="
                display: flex;
                justify-content: space-around;
                font-size: 12px;
              "
            >
              <div>法定代表人</div>
              <div>{{ Times }}</div>
            </div>
          </div>
        </div>
      </div>
      <!-- <div class="pdefDomContent">
        <div class="pdfDom1">
          <div id="pdfDom" ref="print" style="padding: 2px 12px">
            <div style="border-bottom: 1px solid #ccc; margin-bottom: 5px">
              <div class="lic_topContent">
                <div class="lic_Name">License Information</div>
                <div class="lic_time">{{ SigningTimeString }}</div>
              </div>
              <div class="lic_product">
                ProductName：{{ formItem.ProductName }}
              </div>
              <div class="lic_orderNo">OrderNo: {{ formItem.OrderNo }}</div>
            </div>
            <div class="lic_content">
              <div class="lic_li">PartnerID= {{ formItem.PartnerId }}</div>
              <div class="lic_li">OwnerName= {{ formItem.CustomerName }}</div>
              <Row>
                <Col span="9" class="lic_li"
                  >MaxUsers= {{ formItem.MaxUser }}</Col
                >
                <Col span="8" class="lic_li"
                  >MaxReport= {{ formItem.MaxReport }}</Col
                >
                <Col span="7" class="lic_li"
                  >MaxSite= {{ formItem.MaxSite }}</Col
                >
              </Row>
              <Row>
                <Col span="9" class="lic_li"
                  >Expiration= {{ ExpireTimeString }}</Col
                >
                <Col span="8" class="lic_li"
                  >VersionTag= {{ isTrialString }}</Col
                >
                <Col span="7" class="lic_li">
                  LicenseVersion= {{ formItem.LicenseVersion }}
                </Col>
              </Row>

              <div class="lic_li">
                LICENSE KEY:
                <span class="lic_small">{{
                  formItem.BusinessLicenseCode
                }}</span>
              </div>
            </div>
          </div>
        </div>
      </div> -->
    </div>
  </div>
</template>

<script>
import Prints from "@/libs/print.js";

export default {
  data() {
    return {
      htmlTitle: "许可证书",
      formItem: {
        SigningTime: 0,
        ProductName: "",
        OrderNo: "",
        PartnerId: "",
        CustomerName: "",
        MaxUser: 0,
        MaxReport: 0,
        MaxSite: 0,
        ExpireTime: 0,
        IsTrial: 0, //0正式
        LicenseVersion: "",
        BusinessLicenseCode: "",
      },
      SigningTimeString: "",
      ExpireTimeString: "",
      isTrialString: "", // Enterprise | Trial
      Times:"",
    };
  },
  methods: {
    handlePrint() {
      Prints(this.$refs.print);
    },
    getNowTime() {
      let date = new Date();
      let year = date.getFullYear();
      let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
      let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
      return `${year}.${month}.${day}`;
    },
  },
  activated(){
    this.Times = this.getNowTime();
  },
};
</script>

<style lang="less" scoped>
.partnerAttorney {
  .topBtn {
    width: 590px;
    margin: auto;
    text-align: right;
  }
  .pdefDomContent {
    display: flex;
    justify-content: center;
    margin: 10px 0;
    .pdfDom1 {
      padding: 0 10px;
      border: 2px solid #666;
      min-width: 590px;
      max-width: 590px;
      height: 590px;
      color: #000000;
      .pdf_top {
        font-size: 37px !important;
        font-weight: 600;
        margin: 25px 0;
        padding-top: 25px;
        font-family: SimHei;
        margin-bottom: 25px;
      }
      .pdf_company {
        color: #916a4d;
        font-weight: 800;
        font-family: SimSun;
        font-size: 37px !important;
      }
      .pdf_enCompany {
        font-size: 13px !important;
        margin: 20px 0 45px 0;
      }
      .pdf_content {
        display: flex;
        margin: 5px 70px;
        font-size: 14px !important;
        text-align: left;
        .pdt_Bold {
          font-weight: 600;
        }
      }
      .pdf_base {
        margin: 20px 70px;
        text-align: left;
        font-size: 12px !important;
      }
      .pdf_chapterImg {
        margin-top: 55px;
        img {
          width: 100%;
          background-color: white;
        }
      }
    }
  }
}
</style>
